<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    var number = prompt('请输入数字');
    var result = number <  10 ? '0' + number : number;
    alert(result);
</script>
<body>

</body>
</html>